import { simple } from '@/api/hmmm/subjects'
import { subjectlable, remove } from '@/api/hmmm/questions'
import { list } from '@/api/hmmm/companys'
const state = {
  list: [], // 学科
  label: [], // 二级目录
  company: [] // 企业
}
const mutations = {
  // 获取科目
  getList (state, payload) {
    state.list = payload
  },
  // 获取目录
  getlabel (state, payload) {
    state.label = payload
  },
  // 获取企业
  getcompany (state, payload) {
    state.company = payload
  },
  // 删除基础题目
  del (state, payload) {

  }
}
const actions = {
  // 获取科目
  async getList ({ commit }) {
    const { data } = await simple()
    // console.log(data)
    commit('getList', data)
  },
  // 获取目录
  async getlabel ({ commit }, subjectID) {
    const { data } = await subjectlable({ subjectID })
    // console.log(data)
    commit('getlabel', data)
  },
  async getcompany ({ commit }) {
    const { data } = await list()
    // console.log(data.items)
    commit('getcompany', data.items)
  },
  // 删除基础题目
  async del ({ commit }, id) {
    await remove({ id })
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
